<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            var findMinArrowShots = function (points) {
                //先根据起始点从小到大进行排序
                points.sort((a, b) => a[0] - b[0])
                let result = 1
                for (let i = 1; i < points.length; i++) {
                    //没有相交
                    if (points[i][0] > points[i - 1][1]) {
                        result++
                    } else {
                        //相交的话进行合并，更新其最小右边界
                        points[i][1] = Math.min(points[i - 1][1], points[i][1])
                    }
                }
                return result
            }
        </script>
    </body>
</html>
